package com.aitaoxue.palx.ui;

import android.view.View;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import butterknife.InjectView;

import com.aitaoxue.palx.R;
import com.aitaoxue.palx.api.ApiHttpClient;
import com.aitaoxue.palx.base.BaseActivity;

public class WebViewActivity extends BaseActivity{
	@InjectView(R.id.webView)
	WebView view;

	@Override
	protected boolean hasBackButton() {
		return true;
	}
	
	@Override
	protected int getActionBarTitle() {
		return R.string.web_content;
	}
	
	@Override
	protected int getLayoutId() {
		return R.layout.activity_web;
	}
	
	@Override
	public void onClick(View v) {
		
	}

	@Override
	public void initView() {
		WebSettings settings=view.getSettings();
		settings.setJavaScriptEnabled(true);
		
		view.loadUrl(ApiHttpClient.SERVER_PROTOCOL);
		view.setWebViewClient(new MyWebViewClient());
	}

	@Override
	public void initData() {
		
	}
	
	private class MyWebViewClient extends WebViewClient{
		@Override
		public boolean shouldOverrideUrlLoading(WebView view, String url) {
			view.loadUrl(url);
			return true;
		}
	}
	
}





